﻿using MySql.Data.MySqlClient;
using System;
using System.Data;

namespace Service.Repository
{
    public class DapperConnectionFactory
    {
        private string _connString = String.Empty;
        private string ConnectionString => _connString;

        public DapperConnectionFactory(string connStr)
        {
            this._connString = connStr;
        }

        /// <summary>
        /// 创建数据库连接对象并打开链接
        /// </summary>
        /// <returns></returns>
        public IDbConnection CreateDbConnection()
        {
            return new MySqlConnection(ConnectionString);
        }

    }
}
